import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Random;

import javax.imageio.ImageIO;

import com.dinim.graphics.IDrawable;
import com.dinim.object.IObject2D;
import com.dinim.object.ITransformable;
import com.dinim.object.Rectangle2D;


public class ImageTester {

    public static void main(String[] args) throws IOException {
        File imagefile = new File("D:\\Data\\t343490\\Blue hills.jpg");
        
        BufferedImage img = ImageIO.read(imagefile);
        
        Canvasframe cf = new Canvasframe(500, 500);
        cf.getCanvas().drawLine(10, 10, 100, 100);
        cf.paintCanvas();
        
        Random r = new Random();
        
        IObject2D obj1 = new Rectangle2D(200, 200, 100, 100);
        
        while(true){
            cf.clearCanvas();
            //cf.getCanvas().drawLine(r.nextInt(), r.nextInt(), cf.component.getWidth(), cf.component.getHeight());
            ((IDrawable)obj1).draw(cf.getCanvas());
            ((ITransformable)obj1).rotate(1, obj1.getCenterPoint());
            cf.paintCanvas();
            try {
                Thread.sleep(20);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
    
}
